from typing import TypeVar
from typing import Optional
from typing import Any
from typing import Generic

from pydantic import BaseModel
from pydantic.generics import GenericModel

DataT = TypeVar('DataT')


class Response(GenericModel, Generic[DataT]):
    code: int = 0
    errmsg: str = 'ok'
    data: Optional[DataT]
    count: Optional[Any]


class Token(BaseModel):
    id: int
    username: str
    token: str
